/**
 * Created by chencheng on 2017/6/13.
 */

/**
 *
 * @type {{rootRoute: string, login: *, dHub_pluginManage: *, dHub_hostMonitor: *, dHub_pluginMonitor: *, dMart_dataSource: *, dVisual_bigScreen: *}}
 */
const EnumRouter = {
    rootRoute: '',		// 根路由

    login: 'login',		// 登陆

    /*
     |-----------------------------------------------
     | 可视化组件-相关的路由
     |-----------------------------------------------
     */
    bigScreen_echarts: 'echarts',
    bigScreen_highcharts: 'highcharts',
    bigScreen_d3: 'd3',
    bigScreen_cesium: 'cesium',
    bigScreen_three: 'three',
    bigScreen_htmlComponents: 'htmlComponents',
    bigScreen_leaflet: 'leaflet',
    bigScreen_mapbox: 'mapbox',

    /*
     |-----------------------------------------------
     | 数据可视化-相关的路由
     |-----------------------------------------------
     */
    dVisual_bigScreen: 'dataVisual/bigScreen',

    /*
        |-----------------------------------------------
        | 用户管理-相关的路由
        |-----------------------------------------------
        */
    amap: 'map/amap', // 高德地图
    qmap: 'map/qmap', // 腾旭地图
    bmap: 'map/bmap',   // 百度地图
    gmap: 'map/gmap',   // 百度地图


    /*
     |-----------------------------------------------
     | 用户管理-相关的路由
     |-----------------------------------------------
     */
    userManager: 'setting/userManager',
    dashboard: 'setting/dashboard',
};


export default (() => {
    let routes = {};
    for (let [key, route] of Object.entries(EnumRouter)) {
        Object.defineProperty(routes, key, {
            get: () => {
                return window.ENV.rootPath + route;

                // TODO 后续改用这种方式

                // const path = window.ENV.rootPath + route;
                // return {
                //     path,
                //     // 实例化url参数
                //     getUrl: (params = {}) => {
                //         return T.lodash.isEmpty(params) ? path : path + '?' + T.queryString.stringify(params);
                //     }
                // };
            },
            configurable: false
        });
    }

    return routes;
})();
